<{include file="www/header.tpl"}>
<{include file="www/header-base.tpl"}>

<div class="top-banner">
    <img class="img" src="/resource/www/imgs/library.jpg">
    <p class="info">寻找你感兴趣的景点</p>
    <div class="content-search">
        <form class="search-form" action="" method="get" style="width:540px;">
           <div class='city' style="width:204px;">
           <span class="text"><{if $scity}><{$scity}><{else}>目的地<{/if}></span>
           <div class='city-wrap' style="display:none;">
             <ul class="country-box">
             <{foreach from=$cityList item=citys name=countryBox key=country}>
             <{if $smarty.foreach.countryBox.index==0}>     
             <li country="<{$country}>" class="active"><{$country}></li>
             <{else}>
             <li country="<{$country}>"><{$country}></li>
             <{/if}>
             <{/foreach}>
             </ul>

             <{foreach from=$cityList item=citys name=cityBox key=country}>
             <div class='city-item' country='<{$country}>' 
             <{if $smarty.foreach.cityBox.index==0}>
             <{else}>     
             style="display:none;"
             <{/if}>
             >
             
             <{foreach from=$citys item=city key=cityId}>
             <a href='javascript:void(0);' data='<{$cityId}>' country='<{$country}>'><{$city}></a>
             <{/foreach}>
             </div>
             <{/foreach}>
             
             <input type=hidden name='city' value='<{$scityId}>'>  
             </div>
            </div>
            
            <select name="type" class="number"  style="width: 204px;">
               <option value="-1">景点类型</option>
                <{foreach from=$typeList key=k item=type}>
                <option value="<{$k}>" <{if $k == $stype}>selected<{/if}>><{$type}></option>
                <{/foreach}>
            </select>

            <input class="submit" type="button" value="景点搜索" onclick="return submit_scen();">
        </form>
    </div>
</div>

<ul class="scen-list loadimg fix" style="min-height: 480px">
    <{if $data|@count == 0}>
    <div class="box-none" style="padding-top: 100px;">
        <img src="/resource/www/imgs/box_none_icon.png" class="img">
        <p class="text">抱歉，没有找到您要查找的内容</p>
    </div>
    <{else}>
    <{foreach from=$data item=v}>
        <li class="li">
            <a target="_blank" href="/scenicspot/detail/<{$v.id}>" class="a">
                <img src="<{$v.thumb}>" class="img">
                <p class="info fix">
                    <span class="left"><{$v.name}></span>
                    <span class="right">评价数：<{$v.comments}>条</span>
                </p>
                <div class="prompt">
                    <{$v.summary|mb_substr:0:40:'utf-8'}>
                    <{if $v.summary|strlen > 40}>
                    ...
                   <{/if}> 
                </div>
                <span class="view-dei">查看详情</span>
            </a>
        </li>
    <{/foreach}>
    <{/if}>

</ul>
<{if $pagination}>

<div class="discuss_wrap">
    <{$pagination}>
</div>

<{/if}>
<script type="text/javascript">
            var contentsearchOY = $("div.content-search").offset().top;
$(window).scroll(function(){
            var contentsearchY=contentsearchOY-$(document).scrollTop();
            if(contentsearchY<=0){
            $("div.content-search").removeAttr("style");
            $("div.content-search").css({"position":"fixed","top":0,"left":0});
            }else if(contentsearchY>0){
            $("div.content-search").removeAttr("style");
            $("div.content-search").css({"position":"absolute","bottom":0,"left":0});
            }
});
</script>
<script>
//城市选择
$(".city .text").click(function(e){
    e.stopPropagation();
    $('.city-wrap').toggle();
});
$('.country-box li').click(function(e){
    e.stopPropagation();
    $('.country-box li').removeClass('active'); 
    $(this).addClass('active');
    $('.city-item').hide();
    var country=$(this).attr('country');
    $('.city-item[country='+country+']').show();
})
$('.city-wrap .city-item a').click(function(){
    var id=$(this).attr('data');
    var city=$(this).html();
    $("input[name='city']").val(id);
    $('.city-wrap').hide();
    $('.city .text').html(city);
    var url='/scenicspotajax/ajax_getTypesByCity';
    $.post(url,{city:id},function(data){
          var str='<option  value="-1">景点类型</option>';
          for(var x in data){
             str+='<option value='+x+'>'+data[x]+'</option>';
          } 
          $("select[name='type']").html(str);
    },'json');
});
//点击其他地方隐藏
$(document).click(function() {
    $('.city-wrap').hide();
});

function submit_scen() {
    var data = $('.search-form').serialize();
    location.href = '/scenicspot/index/?'+data;
}

</script>

<{include file="www/footer.tpl"}>
